if(!jsx3.lang.Class.forName("tibco.admin.enterpriseAssets.uddi.list.Uddi")) {
/**
    **/
    jsx3.Class.defineClass(
            'tibco.admin.enterpriseAssets.uddi.list.Uddi',
            jsx3.gui.LayoutGrid,
            null,
            function(uddi) {
                uddi.prototype.mtxList = null;
                uddi.prototype.multiselected = false;
                uddi.prototype.addInProgress = false;
                uddi.prototype.selection = new jsx3.util.List(0);
                uddi.prototype.subscribeAll = function() {
                    this.mtxList = this.getDescendantOfName("mtxDeployedUddis23");
                    this.callgetUDDIServersRegisteredWithEnterprise();
                    var me = this;
                    tibco.admin.PubSub.subscribe(tibco.admin.enterpriseAssets.sReg.uddi.EventID.UDDI_REFRESH, me, me.callgetUDDIServersRegisteredWithEnterprise);
                    tibco.admin.PubSub.subscribe(tibco.admin.enterpriseAssets.sReg.uddi.EventID.ADD_OVER, me, me.addOver);
                    tibco.admin.PubSub.subscribe(tibco.admin.enterpriseAssets.sReg.uddi.EventID.DISABLED_REFRESH, me, me.setRefreshDisabled);
                    tibco.admin.PubSub.subscribe(tibco.admin.enterpriseAssets.sReg.uddi.EventID.ENABLED_REFRESH, me, me.setRefreshEnable);
                    this.loadPermissionButtons();
                }

                uddi.prototype.unSubscribeAll = function() {
                    var me = this;
                    tibco.admin.PubSub.unsubscribe(tibco.admin.enterpriseAssets.sReg.uddi.EventID.UDDI_REFRESH, me, me.callgetUDDIServersRegisteredWithEnterprise);
                    tibco.admin.PubSub.unsubscribe(tibco.admin.enterpriseAssets.sReg.uddi.EventID.ADD_OVER, me, me.addOver);
                    tibco.admin.PubSub.unsubscribe(tibco.admin.enterpriseAssets.sReg.uddi.EventID.DISABLED_REFRESH, me, me.setRefreshDisabled);
                    tibco.admin.PubSub.unsubscribe(tibco.admin.enterpriseAssets.sReg.uddi.EventID.ENABLED_REFRESH, me, me.setRefreshEnable);
                }

                uddi.prototype.addOver = function(objEvent) {
                    var buttons = this.getDescendantsOfType(jsx3.gui.Button, false);
                    for(var i = 0; i < buttons.length; i++) {
                        buttons[i].setEnabled(jsx3.gui.Form.STATEENABLED, true);
                    }
                    this.callgetUDDIServersRegisteredWithEnterprise();
                    if(objEvent.entityID) {
                        this.mtxList.selectRecord(objEvent.entityID);
                    }
                    this.updateButtons();
                }

                uddi.prototype.tryToRemoveUddiServers = function() {
                    var cacheRecords = this.mtxList.getXML().getRootNode().selectNodes("//record[@jsxselected='1']");
                    tibco.admin.util.Log.SERVICE.trace("The number of checked records is [\n" + cacheRecords.getLength() + "]");
                    if(cacheRecords.getLength() == 0) {
                        tibco.admin.Main.alert(tibco.admin.Main.getServer().getDynamicProperty("@lblNoUddi23"), tibco.admin.Main.getServer().getDynamicProperty("@lblSelectUddi23"));
                        return;
                    }
                    var me = this;
                    tibco.admin.Main.confirm(
                            tibco.admin.Main.getServer().getDynamicProperty("@lblDeleteUddi23"),
                            tibco.admin.Main.getServer().getDynamicProperty("@lblDeleteUddiConfirm23"),
                            function(dialog) {
                                dialog.doClose();
                                me.callunregisterUDDIServersFromEnterprise();
                            }, null)

                }

                uddi.prototype.callgetUDDIServersRegisteredWithEnterprise = function() {
                    var objService = tibco.admin.Main.loadService("tibco.admin",
                            "tibco/admin/enterpriseAssets/sReg/uddi/list/rules/getRegisteredUddiServersRules.xml",
                            "getUDDIServersRegisteredWithEnterprise",
                            "Get UDDI Servers Registered With Enterprise");
                    var me = this;
                    objService.subscribe(jsx3.net.Service.ON_SUCCESS, me, me.ongetUDDIServersRegisteredWithEnterpriseSuccess);
                    objService.setEndpointURL(tibco.admin.util.ServiceHelper.getUddiServerEndpointURL());
                    objService.doCall();
                };

                uddi.prototype.ongetUDDIServersRegisteredWithEnterpriseSuccess = function(objEvent) {
                    try {
                        this.mtxList.repaint();
                        var cacheDoc = this.mtxList.getXML();
                        if(cacheDoc) {
                            var flag = false;
                            var published = false;
                            var iter = this.selection.iterator();
                            while(iter.hasNext()) {
                                var name = iter.next();
                                var record = this.mtxList.getXML().selectSingleNode("//record[@name='" + name + "']");
                                if(record) {
                                    flag = true;
                                    record.setAttribute("jsxselected", 1);
                                    if(!this.multiselected) {
                                        published = true;
                                        this.publishSelect(record.getAttribute("jsxid"));
                                    }
                                }
                            }
                            if(!flag || this.multiselected) {
                                var msg = new Object();
                                msg.subject = tibco.admin.enterpriseAssets.sReg.uddi.EventID.UDDI_DELETED;
                                tibco.admin.PubSub.publish(msg);
                                this.updateButtons();
                            }
                            else if(!published) {
                                this.updateButtons();
                            }
                        }
                    }
                    catch(ex) {
                        jsx3.log(ex);
                        tibco.admin.Main.logException(ex);
                    }
                };

                uddi.prototype.callunregisterUDDIServersFromEnterprise = function() {
                    var objService = tibco.admin.Main.loadService("tibco.admin",
                            "tibco/admin/enterpriseAssets/sReg/uddi/list/rules/unregisterUddiServersRules.xml",
                            "unregisterUDDIServersFromEnterprise",
                            "Unregister UDDI Servers Registered With Enterprise");
                    var me = this;
                    objService.subscribe(jsx3.net.Service.ON_SUCCESS, me, me.onunregisterUDDIServersFromEnterpriseSuccess);
                    objService.setEndpointURL(tibco.admin.util.ServiceHelper.getUddiServerEndpointURL());
                    objService.doCall();
                };

                uddi.prototype.onunregisterUDDIServersFromEnterpriseSuccess = function(objEvent) {
                    this.callgetUDDIServersRegisteredWithEnterprise();
                };

                uddi.prototype.publishSelect = function(selectedIDs) {
                    if(this.ignoreSelects) {
                        var cacheDoc = this.mtxList.getXML();
                        if(cacheDoc) {
                            var recordIter = cacheDoc.getXML().selectNodes("//record[@jsxselected='1']");
                            while(recordIter.hasNext()) {
                                var record = recordIter.next();
                                record.setAttribute("jsxselected", 0);
                            }
                            var iter = this.selection.iterator();
                            while(iter.hasNext()) {
                                var name = iter.next();
                                var record = cacheDoc.getXML().selectSingleNode("//record[@name='" + name + "']");
                                if(record) {
                                    record.setAttribute("jsxselected", 1);
                                }
                            }
                        }
                        this.mtxList.repaint();
                        return;
                    }
                    else {
                        this.multiselected = false;
                        this.selection.clear();
                        var nodes = this.mtxList.getSelectedNodes();
                        var selectionSize = nodes.size();
                        for(var i = 0; i < selectionSize; i++) {
                            this.selection.add(nodes.getItem(i).getAttribute('name'));
                        }
                        if(selectionSize > 1) {
                            this.multiselected = true;
                        }
                    }
                    var sel = this.mtxList.getSelectedNodes();
                    if(sel && sel.size() == 1) {
                        var record = sel.getItem(0);
                        var msg = new Object();
                        msg.subject = tibco.admin.enterpriseAssets.sReg.uddi.EventID.UDDI_SELECTED;
                        msg.name = record.getAttribute("name");
                        msg.entityID = record.getAttribute("entityid");
                        msg.description = record.getAttribute("description");
                        msg.inquiryURL = record.getAttribute("inquiryurl");
                        msg.publishURL = record.getAttribute("publishurl");
                        msg.userName = record.getAttribute("username");
                        msg.password = record.getAttribute("password");
                        msg.useBasicAuthentication = record.getAttribute("usebasicauthentication");
                        msg.useProxy = record.getAttribute("useproxy");
                        msg.proxyHost = record.getAttribute("proxyhost");
                        msg.proxyPort = record.getAttribute("proxyport");
                        msg.proxyUserName = record.getAttribute("proxyusername");
                        msg.proxyPassword = record.getAttribute("proxypassword");
                        msg.hasOwner = record.getAttribute("hasOwner");
                        msg.hasEdit = record.getAttribute("hasEdit");
                        tibco.admin.PubSub.publish(msg);
                    }
                    else {
                        var msg = new Object();
                        msg.subject = tibco.admin.enterpriseAssets.sReg.uddi.EventID.UDDI_DELETED;
                        tibco.admin.PubSub.publish(msg);
                    }
                    this.updateButtons();
                }

                uddi.prototype.updateButtons = function() {
                    var nodes = this.mtxList.getSelectedNodes();
                    var count = nodes.size();
                    tibco.admin.Main.getServer().getJSXByName("btnAddUddi_23").setEnabled((!this.ignoreSelects) ? jsx3.gui.Form.STATEENABLED : jsx3.gui.Form.STATEDISABLED, true);
                    tibco.admin.Main.getServer().getJSXByName("btnRemoveUddi_23").setEnabled(((count > 0) && !this.ignoreSelects) ? jsx3.gui.Form.STATEENABLED : jsx3.gui.Form.STATEDISABLED, true);
                }

                uddi.prototype.publishAdd = function() {
                    var buttons = this.getDescendantsOfType(jsx3.gui.Button, false);
                    for(var i = 0; i < buttons.length; i++) {
                        buttons[i].setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                    }
                    this.addInProgress = true;
                    this.ignoreSelects = true;
                    this.updateButtons();
                    this.mtxList.deselectAllRecords();
                    this.mtxList.repaintData();
                    var msg = new Object();
                    msg.subject = tibco.admin.enterpriseAssets.sReg.uddi.EventID.ADD_IN_PROGRESS;
                    tibco.admin.PubSub.publish(msg);
                    msg = new Object();
                    msg.subject = tibco.admin.enterpriseAssets.sReg.uddi.EventID.DISABLED_REFRESH;
                    tibco.admin.PubSub.publish(msg);
                }

                uddi.prototype.onRefresh = function() {
                    this.callgetUDDIServersRegisteredWithEnterprise();
                }

                uddi.prototype.mtxDeployedUddis23_OnSelect = function(selectedIds) {
                    this.publishSelect(selectedIds);
                }

                /**
                 * Call this method when user clicked "Set Permissions" button.
                 */
                uddi.prototype.btnSetPermissions_23_OnClick = function() {
                    var dlgSetPermissions = APP.tibco.admin.getBodyBlock().load(
                            "tibco/admin/enterpriseAssets/userMgt/window/permissions/ui/addUsersNGroups.xml");

                    var selectedNodes = this.getDescendantOfName("mtxDeployedUddis23").getSelectedNodes();
                    var entityName = selectedNodes.get(0).getAttribute("name");
                    var entityId = selectedNodes.get(0).getAttribute("entityid");

                    dlgSetPermissions.setPermission("UDDIServer", entityName, entityId);
                };

                /**
                 * Call this method when user clicked "Add Permissions" menuitem.
                 */
                uddi.prototype.addPermissions = function() {
                    var dlgAddPermissions = APP.tibco.admin.getBodyBlock().load(
                            "tibco/admin/enterpriseAssets/userMgt/window/permissions/ui/addUsersNGroups.xml");

                    // create selected list
                    var entityNameIds = [];
                    var selectedNodes = this.getDescendantOfName("mtxDeployedUddis23").getSelectedNodes();
                    var selectedNumber = selectedNodes.size();
                    for(var i = 0; i < selectedNumber; i++)
                    {
                        entityNameIds.push({"name": selectedNodes.get(i).getAttribute("name"),
                            "id": selectedNodes.get(i).getAttribute("entityid")});
                    }

                    dlgAddPermissions.setBulkPermission("UDDIServer", entityNameIds);
                };

                /**
                 * Call this method when user clicked "Remove Permissions" menuitem.
                 */
                uddi.prototype.removePermissions = function() {
                    // remember, pubish must before loaded the dialog
                    var msg = new Object();
                    msg.subject = tibco.admin.enterpriseAssets.userMgt.EventID.REMOVE_PERMISSION_M_LOADED;
                    msg.entityType = "UDDIServer";
                    msg.entityIds = [];
                    // create selected list
                    var selectedNodes = this.getDescendantOfName("mtxDeployedUddis23").getSelectedNodes();
                    var selectedNumber = selectedNodes.size();
                    for(var i = 0; i < selectedNumber; i++)
                    {
                        msg.entityIds.push(selectedNodes.get(i).getAttribute("entityid"));
                    }
                    tibco.admin.PubSub.publish(msg);

                    tibco.admin.Main.loadUIResource(tibco.admin.Main.getServer().getBodyBlock(), "tibco.admin", "tibco/admin/enterpriseAssets/userMgt/window/permissions/ui/removePermissionsM.xml");
                };

                uddi.prototype.setRefreshDisabled = function(objEvent) {
                    this.getDescendantOfName("btnRefresh_23").setEnabled(jsx3.gui.Form.STATEDISABLED, true);
                };

                uddi.prototype.setRefreshEnable = function(objEvent) {
                    this.getDescendantOfName("btnRefresh_23").setEnabled(jsx3.gui.Form.STATEENABLED, true);
                };

                uddi.prototype.beginEditMode = function() {
                    this.ignoreSelects = true;
                    this.updateButtons();
                }

                uddi.prototype.endEditMode = function() {
                    this.ignoreSelects = false;
                    this.updateButtons();
                }

                /****************************************************************
                 *  Set permission and remove permission
                 *  Author: Alex Han
                 *  Date: 07-10-2007
                 ****************************************************************/

                uddi.prototype.loadPermissionButtons = function() {
                    var domNode = this.getDescendantOfName("panePermissionsButtons23");
                    this.permissions = tibco.admin.Main.loadUIResource(domNode, "tibco.admin", "tibco/admin/enterpriseAssets/userMgt/window/permissions/ui/setPermissions.xml", true);
                    this.permissions.initialize("UDDIServer", "entityid", "name", this.mtxList);
                    var me = this;
                    this.mtxList.switchPermissionBtn = function() {
                        me.permissions.switchPermissionBtn();
                    }
                }

                //=========== END OF SET PERMISSION ===============================================

            }
            )
}